<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActiveSupport::XmlMini</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Module</span> 
            ActiveSupport::XmlMini 
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/activesupport/lib/active_support/xml_mini_rb.html">activesupport/lib/active_support/xml_mini.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<h1 id="label-XmlMini"><a href="XmlMini.html">XmlMini</a></h1>

<p>To use the much faster libxml parser:</p>

<pre>gem 'libxml-ruby', '=0.9.7'
XmlMini.backend = 'LibXML'</pre>

    </div>
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>#</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="XmlMini.html#method-i-_dasherize">_dasherize</a>,
              </li>
            
              
              <li>
                <a href="XmlMini.html#method-i-_parse_file">_parse_file</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>B</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="XmlMini.html#method-i-backend">backend</a>,
              </li>
            
              
              <li>
                <a href="XmlMini.html#method-i-backend-3D">backend=</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>R</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="XmlMini.html#method-i-rename_key">rename_key</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>T</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="XmlMini.html#method-i-to_tag">to_tag</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>W</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="XmlMini.html#method-i-with_backend">with_backend</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">DEFAULT_ENCODINGS</td>
            <td>=</td>
            <td class="attr-value">{
&quot;binary&quot; =&gt; &quot;base64&quot;
} unless defined?(DEFAULT_ENCODINGS)</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">TYPE_NAMES</td>
            <td>=</td>
            <td class="attr-value">{
&quot;Symbol&quot;     =&gt; &quot;symbol&quot;,
&quot;Fixnum&quot;     =&gt; &quot;integer&quot;,
&quot;Bignum&quot;     =&gt; &quot;integer&quot;,
&quot;BigDecimal&quot; =&gt; &quot;decimal&quot;,
&quot;Float&quot;      =&gt; &quot;float&quot;,
&quot;TrueClass&quot;  =&gt; &quot;boolean&quot;,
&quot;FalseClass&quot; =&gt; &quot;boolean&quot;,
&quot;Date&quot;       =&gt; &quot;date&quot;,
&quot;DateTime&quot;   =&gt; &quot;dateTime&quot;,
&quot;Time&quot;       =&gt; &quot;dateTime&quot;,
&quot;Array&quot;      =&gt; &quot;array&quot;,
&quot;Hash&quot;       =&gt; &quot;hash&quot;
} unless defined?(TYPE_NAMES)</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">FORMATTING</td>
            <td>=</td>
            <td class="attr-value">{
&quot;symbol&quot;   =&gt; Proc.new { |symbol| symbol.to_s },
&quot;date&quot;     =&gt; Proc.new { |date| date.to_s(:db) },
&quot;dateTime&quot; =&gt; Proc.new { |time| time.xmlschema },
&quot;binary&quot;   =&gt; Proc.new { |binary| ::Base64.encode64(binary) },
&quot;yaml&quot;     =&gt; Proc.new { |yaml| yaml.to_yaml }
} unless defined?(FORMATTING)</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
          <tr valign='top'>
            <td class="attr-name">PARSING</td>
            <td>=</td>
            <td class="attr-value">{
&quot;symbol&quot;       =&gt; Proc.new { |symbol|  symbol.to_sym },
&quot;date&quot;         =&gt; Proc.new { |date|    ::Date.parse(date) },
&quot;datetime&quot;     =&gt; Proc.new { |time|    Time.xmlschema(time).utc rescue ::DateTime.parse(time).utc },
&quot;integer&quot;      =&gt; Proc.new { |integer| integer.to_i },
&quot;float&quot;        =&gt; Proc.new { |float|   float.to_f },
&quot;decimal&quot;      =&gt; Proc.new { |number|  BigDecimal(number) },
&quot;boolean&quot;      =&gt; Proc.new { |boolean| %w(1 true).include?(boolean.strip) },
&quot;string&quot;       =&gt; Proc.new { |string|  string.to_s },
&quot;yaml&quot;         =&gt; Proc.new { |yaml|    YAML::load(yaml) rescue yaml },
&quot;base64Binary&quot; =&gt; Proc.new { |bin|     ::Base64.decode64(bin) },
&quot;binary&quot;       =&gt; Proc.new { |bin, entity| _parse_binary(bin, entity) },
&quot;file&quot;         =&gt; Proc.new { |file, entity| _parse_file(file, entity) }
}</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-backend">
            
              <b>backend</b>()
            
            <a href="XmlMini.html#method-i-backend" name="method-i-backend" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-backend_source')" id="l_method-i-backend_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/1fab2002e3385c40ef48008b649d78ce5e16a868/activesupport/lib/active_support/xml_mini.rb#L81" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-backend_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/xml_mini.rb, line 81</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">backend</span>
  <span class="ruby-identifier">current_thread_backend</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@backend</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-backend-3D">
            
              <b>backend=</b>(name)
            
            <a href="XmlMini.html#method-i-backend-3D" name="method-i-backend-3D" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-backend-3D_source')" id="l_method-i-backend-3D_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/1fab2002e3385c40ef48008b649d78ce5e16a868/activesupport/lib/active_support/xml_mini.rb#L85" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-backend-3D_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/xml_mini.rb, line 85</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">backend=</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">backend</span> = <span class="ruby-identifier">name</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">cast_backend_name_to_module</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">current_thread_backend</span> = <span class="ruby-identifier">backend</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">current_thread_backend</span>
  <span class="ruby-ivar">@backend</span> = <span class="ruby-identifier">backend</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-rename_key">
            
              <b>rename_key</b>(key, options = {})
            
            <a href="XmlMini.html#method-i-rename_key" name="method-i-rename_key" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-rename_key_source')" id="l_method-i-rename_key_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/1fab2002e3385c40ef48008b649d78ce5e16a868/activesupport/lib/active_support/xml_mini.rb#L132" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-rename_key_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/xml_mini.rb, line 132</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">rename_key</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">options</span> = {})
  <span class="ruby-identifier">camelize</span>  = <span class="ruby-identifier">options</span>[<span class="ruby-value">:camelize</span>]
  <span class="ruby-identifier">dasherize</span> = <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-value">:dasherize</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:dasherize</span>]
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">camelize</span>
    <span class="ruby-identifier">key</span> = <span class="ruby-keyword">true</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">camelize</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">camelize</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">camelize</span>(<span class="ruby-identifier">camelize</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-identifier">key</span> = <span class="ruby-identifier">_dasherize</span>(<span class="ruby-identifier">key</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">dasherize</span>
  <span class="ruby-identifier">key</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-to_tag">
            
              <b>to_tag</b>(key, value, options)
            
            <a href="XmlMini.html#method-i-to_tag" name="method-i-to_tag" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-to_tag_source')" id="l_method-i-to_tag_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/1fab2002e3385c40ef48008b649d78ce5e16a868/activesupport/lib/active_support/xml_mini.rb#L99" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-to_tag_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/xml_mini.rb, line 99</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">to_tag</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">options</span>)
  <span class="ruby-identifier">type_name</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:type</span>)
  <span class="ruby-identifier">merged_options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-value">:root</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">key</span>, <span class="ruby-value">:skip_instruct</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span>)

  <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Method</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Proc</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">arity</span> <span class="ruby-operator">==</span> <span class="ruby-number">1</span>
      <span class="ruby-identifier">value</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">merged_options</span>)
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">value</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">merged_options</span>, <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">singularize</span>)
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_xml</span>)
    <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_xml</span>(<span class="ruby-identifier">merged_options</span>)
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">type_name</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">TYPE_NAMES</span>[<span class="ruby-identifier">value</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>]
    <span class="ruby-identifier">type_name</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">value</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-value">:to_str</span>)
    <span class="ruby-identifier">type_name</span>   = <span class="ruby-identifier">type_name</span>.<span class="ruby-identifier">to_s</span>   <span class="ruby-keyword">if</span> <span class="ruby-identifier">type_name</span>
    <span class="ruby-identifier">type_name</span>   = <span class="ruby-string">&quot;dateTime&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">type_name</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;datetime&quot;</span>

    <span class="ruby-identifier">key</span> = <span class="ruby-identifier">rename_key</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">options</span>)

    <span class="ruby-identifier">attributes</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:skip_types</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">type_name</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">?</span> { } <span class="ruby-operator">:</span> { <span class="ruby-value">:type</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">type_name</span> }
    <span class="ruby-identifier">attributes</span>[<span class="ruby-value">:nil</span>] = <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>

    <span class="ruby-identifier">encoding</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:encoding</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_ENCODINGS</span>[<span class="ruby-identifier">type_name</span>]
    <span class="ruby-identifier">attributes</span>[<span class="ruby-value">:encoding</span>] = <span class="ruby-identifier">encoding</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">encoding</span>

    <span class="ruby-identifier">formatted_value</span> = <span class="ruby-constant">FORMATTING</span>[<span class="ruby-identifier">type_name</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">?</span>
      <span class="ruby-constant">FORMATTING</span>[<span class="ruby-identifier">type_name</span>].<span class="ruby-identifier">call</span>(<span class="ruby-identifier">value</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">value</span>

    <span class="ruby-identifier">options</span>[<span class="ruby-value">:builder</span>].<span class="ruby-identifier">tag!</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">formatted_value</span>, <span class="ruby-identifier">attributes</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-with_backend">
            
              <b>with_backend</b>(name)
            
            <a href="XmlMini.html#method-i-with_backend" name="method-i-with_backend" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-with_backend_source')" id="l_method-i-with_backend_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/1fab2002e3385c40ef48008b649d78ce5e16a868/activesupport/lib/active_support/xml_mini.rb#L91" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-with_backend_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/xml_mini.rb, line 91</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">with_backend</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-identifier">old_backend</span> = <span class="ruby-identifier">current_thread_backend</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">current_thread_backend</span> = <span class="ruby-identifier">name</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">cast_backend_name_to_module</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">yield</span>
<span class="ruby-keyword">ensure</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">current_thread_backend</span> = <span class="ruby-identifier">old_backend</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
              
      <div class="sectiontitle">Instance Protected methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-_dasherize">
            
              <b>_dasherize</b>(key)
            
            <a href="XmlMini.html#method-i-_dasherize" name="method-i-_dasherize" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-_dasherize_source')" id="l_method-i-_dasherize_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/1fab2002e3385c40ef48008b649d78ce5e16a868/activesupport/lib/active_support/xml_mini.rb#L144" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-_dasherize_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/xml_mini.rb, line 144</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">_dasherize</span>(<span class="ruby-identifier">key</span>)
  <span class="ruby-comment"># $2 must be a non-greedy regex for this to work</span>
  <span class="ruby-identifier">left</span>, <span class="ruby-identifier">middle</span>, <span class="ruby-identifier">right</span> = <span class="ruby-regexp">/\A(_*)(.*?)(_*)\Z/</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">key</span>.<span class="ruby-identifier">strip</span>)[<span class="ruby-number">1</span>,<span class="ruby-number">3</span>]
  <span class="ruby-node">&quot;#{left}#{middle.tr('_ ', '--')}#{right}&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-_parse_file">
            
              <b>_parse_file</b>(file, entity)
            
            <a href="XmlMini.html#method-i-_parse_file" name="method-i-_parse_file" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-_parse_file_source')" id="l_method-i-_parse_file_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/1fab2002e3385c40ef48008b649d78ce5e16a868/activesupport/lib/active_support/xml_mini.rb#L160" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-_parse_file_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/xml_mini.rb, line 160</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">_parse_file</span>(<span class="ruby-identifier">file</span>, <span class="ruby-identifier">entity</span>)
  <span class="ruby-identifier">f</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Base64</span>.<span class="ruby-identifier">decode64</span>(<span class="ruby-identifier">file</span>))
  <span class="ruby-identifier">f</span>.<span class="ruby-identifier">extend</span>(<span class="ruby-constant">FileLike</span>)
  <span class="ruby-identifier">f</span>.<span class="ruby-identifier">original_filename</span> = <span class="ruby-identifier">entity</span>[<span class="ruby-string">'name'</span>]
  <span class="ruby-identifier">f</span>.<span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">entity</span>[<span class="ruby-string">'content_type'</span>]
  <span class="ruby-identifier">f</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    